package com.bawei.module_home.live;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;

import com.bawei.library_base.mvp.v.BaseActivity;
import com.bawei.module_home.R;
import com.tencent.rtmp.TXLivePlayer;
import com.tencent.rtmp.ui.TXCloudVideoView;

public class LiveActivity extends BaseActivity {


    private TXCloudVideoView videoView;
    private TXLivePlayer mLivePlayer;

    @Override
    public int beanLayout() {
        return R.layout.activity_live;
    }

    @Override
    public void initView() {


        videoView = (TXCloudVideoView) findViewById(R.id.video_view);
    }

    @Override
    public void initData() {


//创建 player 对象
        mLivePlayer = new TXLivePlayer(this);

//关键 player 对象与界面 view
        mLivePlayer.setPlayerView(videoView);
        String flvUrl = "https://phonews.qing.mgtv.com/nn_live/nn_x64/cWlkPSZzPTIwMWY4NzIwM2Y3YjE4MzY4NmVjZjU2NGM3YTNiNjhiJmVzPTE2NDA0MTkwNDAmdXVpZD1lOTRiZDkxNDViNmZlNjRkYzU0N2VlOTFiYjUxNmZlYy1kYTQzOGRkMSZ2PTImYXM9MCZjZG5leF9pZD13c19waG9uZTM,/KLGMPP360.m3u8?_t=1640390240244&_t=1640390250541";
        mLivePlayer.startPlay(flvUrl, TXLivePlayer.PLAY_TYPE_VOD_HLS); //推荐 FLV


    }


    @Override
    protected void onDestroy() {
        super.onDestroy();
        mLivePlayer.pause();
        this.finish();
    }
}